import axios from '~/plugins/axios';
import { basicConfig } from '~/assets/js/config'

/**
 * 查询广告系列列表
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getAdseriesList =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adseries/item/list',{
        params : preload || {}
    })
};

/**
 * 查询广告组列表
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getAdgroupList =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/manager/adgroup/item/detail/list',{
        params : preload || {}
    })
};


/**
 * 查询广告列表
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getAdList =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/manager/ad/item/detail/list',{
        params : preload || {}
    })
};


/**
 * 查询该账户下的总余额和总花费的和
 *
 * @param commit
 * @param state
 * @param preload
 */

//按广告系列查询
export const getInfo =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/manager/account/money/info',{
        params : preload || {}
    })
};




/**
 * 查询该账户总花费、总覆盖数、总展示数、总成效数、总cpc、总cpm、总的成效转化率
 *
 * @param commit
 * @param state
 * @param preload
 */

//按广告系列查询
export const getAdseriesTotal =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adseries/query',{
        params : preload || {}
    })
};

//按广告组查询
export const getAdgroupTotal =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adgroup/query',{
        params : preload || {}
    })
};

//按广告查询
export const getAdTotal =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/ad/query',{
        params : preload || {}
    })
};


//------------------------按照广告系列来查询
/**
 * 按查询时间来展示charts1和charts2数据
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getAdseriesDate =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adseries/date',{
        params : preload || {}
    })
};


/**
 * 按位置和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getAdseriesCountryData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adseries/country',{
        params : preload || {}
    })
};


/**
 * 按年龄和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getAdseriesAgeData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adseries/age',{
        params : preload || {}
    })
};


/**
 * 按性别和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getAdseriesGenderData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adseries/gender',{
        params : preload || {}
    })
};


/**
 * 按展示设备和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getAdseriesDeviceData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adseries/device',{
        params : preload || {}
    })
};



//------------------------按照广告组来查询
/**
 * 按查询时间来展示charts1和charts2数据
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getAdgroupDate =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adgroup/date',{
        params : preload || {}
    })
};


/**
 * 按位置和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getAdgroupCountryData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adgroup/country',{
        params : preload || {}
    })
};


/**
 * 按年龄和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getAdgroupAgeData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adgroup/age',{
        params : preload || {}
    })
};


/**
 * 按性别和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getAdgroupGenderData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adgroup/gender',{
        params : preload || {}
    })
};


/**
 * 按展示设备和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getAdgroupDeviceData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/adgroup/device',{
        params : preload || {}
    })
};


//------------------------按照广告来查询
/**
 * 按查询时间来展示charts1和charts2数据
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getAdDate =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/ad/date',{
        params : preload || {}
    })
};


/**
 * 按位置和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getAdCountryData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/ad/country',{
        params : preload || {}
    })
};


/**
 * 按年龄和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getAdAgeData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/ad/age',{
        params : preload || {}
    })
};


/**
 * 按性别和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getAdGenderData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/ad/gender',{
        params : preload || {}
    })
};


/**
 * 按展示设备和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getAdDeviceData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/ad/device',{
        params : preload || {}
    })
};



/*=====================================Google=================================*/
/**
 * 查询广告系列列表
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getGoogleAdseriesList =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/google/adseries/item/list',{
        params : preload || {}
    })
};

/**
 * 查询广告组列表
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getGoogleAdgroupList =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/google/adgroup/item/detail/list',{
        params : preload || {}
    })
};


/**
 * 查询该账户下的总余额和总花费的和
 *
 * @param commit
 * @param state
 * @param preload
 */

//按广告系列查询
export const getGoogleInfo =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/home/google/account/money/info',{
        params : preload || {}
    })
};



/**
 * 查询广告列表
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getGoogleAdList =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/google/ad/item/detail/list',{
        params : preload || {}
    })
};



/**
 * 查询该账户总花费、总展示、总点击、总点击率、CPC
 *
 * @param commit
 * @param state
 * @param preload
 */

//按广告系列查询
export const getGoogleAdseriesTotal =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/google/adseries/query',{
        params : preload || {}
    })
};

//按广告组查询
export const getGoogleAdgroupTotal =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/google/adgroup/query',{
        params : preload || {}
    })
};

//按广告查询
export const getGoogleAdTotal =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/google/ad/query',{
        params : preload || {}
    })
};


//------------------------按照广告系列来查询
/**
 * 按查询时间来展示charts1和charts2数据
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getGoogleAdseriesDate =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/google/adseries/date',{
        params : preload || {}
    })
};


/**
 * 按设备、位置和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getGoogleAdseriesCategoryData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/google/adseries/category',{
        params : preload || {}
    })
};


//------------------------按照广告组来查询
/**
 * 按查询时间来展示charts1和charts2数据
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getGoogleAdgroupDate =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/google/adgroup/date',{
        params : preload || {}
    })
};


/**
 * 按设备、位置和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getGoogleAdgroupCategoryData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/google/adgroup/category',{
        params : preload || {}
    })
};


//------------------------按照广告来查询
/**
 * 按查询时间来展示charts1和charts2数据
 *
 * @param commit
 * @param state
 * @param preload
 */
export const getGoogleAdDate =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/google/ad/date',{
        params : preload || {}
    })
};


/**
 * 按设备、位置和日期查询charts3和charts4数据
 *
 * @param commit
 * @param state
 * @param preload
 */

export const getGoogleAdCategoryData =  function({ commit, state }, preload)  {
    return axios.get(basicConfig.baseUrl + '/statistic/google/ad/category',{
        params : preload || {}
    })
};